<template>
  <div class="drawer" :class="location">
    <div class="main">
      <slot></slot>
    </div>
  </div>
</template>

<script setup lang="ts">
import { PropType } from "vue";
defineProps({
  location: {
    type: String as PropType<"top" | "bottom" | "left" | "right">,
    default: "right",
  },
});
</script>

<style lang="scss" scoped>
.drawer {
  position: fixed;
  z-index: 999;
  &.right {
    width: 50px;
    height: 100vh;
    top: 0;
    right: 0;
    .main {
      top: 0;
      right: -300px;
      width: 300px;
      height: 100vh;
      transition: right 0.5s;
    }
    &:hover {
      .main {
        right: 0;
      }
    }
  }
  .main {
    position: fixed;
  }
}
</style>
